package com.xyht.medicine_management_system.modules.common.controller;


import com.xyht.medicine_management_system.common.commonReturn.ResponseResult;
import com.xyht.medicine_management_system.modules.common.service.MmsImportTaskService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 批量导入任务表 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2023-11-30
 */
@RestController
@RequestMapping("/common/mmsImportTask")
public class MmsImportTaskController {

    @Resource
    private MmsImportTaskService mmsImportTaskService;

    @GetMapping("/list")
    public ResponseResult getImportTaskList(HttpServletRequest request,
                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                            @RequestParam(value = "task_type", required = false) Integer task_type
    ){
        return mmsImportTaskService.getImportTaskList(task_type,request,pageSize,pageNum);
    }

    @GetMapping("/details")
    public ResponseResult getImportTaskDetail(@RequestParam("task_id") String task_id){
        return mmsImportTaskService.getImportTaskDetail(task_id);
    }

}

